"&".join([",".join(my_list[:-1]),my_list[-1]])
I would think would work
or maybe just
",".join(my_list[:-1]) +"&"+my_list[-1]
to handle edge cases where only 2 items you could
"&".join([",".join(my_list[:-1]),my_list[-1]] if len(my_list) > 2 else my_list)
More Related Contents:
- Why dict.get(key) instead of dict[key]?
- Circular (or cyclic) imports in Python
- How to print a single backslash?
- Printing list elements on separate lines in Python
- Keep other columns when doing groupby
- “:=” syntax and assignment expressions: what and why?
- Convert the string 2.90K to 2900 or 5.2M to 5200000 in pandas dataframe
- What does `ValueError: cannot reindex from a duplicate axis` mean?
- How to change the foreground or background colour of a Tkinter Button on Mac OS X?
- Convert regular Python string to raw string
- How to convert ‘binary string’ to normal string in Python3?
- Decorating class methods – how to pass the instance to the decorator?
- Conditionally fill column values based on another columns value in pandas
- Reading a binary file with python
- importing pyspark in python shell
- Return a download and rendered page in one Flask response
- How do I convert a PIL Image into a NumPy array?
- Why is my Python App Engine app using the Translate API getting an error of ImportError: No module named apiclient.discovery?
- How can I create a Word document using Python? [closed]
- Parsing outlook .msg files with python
- Finding label location in a DataFrame Index
- What does ‘# noqa’ mean in Python comments?
- Django: Get an object form the DB, or ‘None’ if nothing matches
- How to calculate the inverse of the normal cumulative distribution function in python?
- What does “sys.argv[1]” mean? (What is sys.argv, and where does it come from?)
- Find the index of the k smallest values of a numpy array
- ModuleNotFoundError: No module named ‘tools.nnwrap’
- Installing NumPy via Anaconda in Windows
- Importing a library from (or near) a script with the same name raises “AttributeError: module has no attribute” or an ImportError or NameError
- TypeError: cannot unpack non-iterable NoneType object