How to merge list to become string without adding any character in python?

2024/11/15 10:02:11

I found that I can join them with '-'.join(name) but I dont want to add any character. Lets say I have ['stanje1', '|', 'st6', ',' 'stanje2', '|', '#'] and I want to be like this

stanje1|st6,stanje2|#
Answer

Just ommit the -:

''.join(name)
https://en.xdnf.cn/q/119436.html

Related Q&A

Removing a key from a nested dictionary based on value

I previusly asked about adding, and someone helped me out with append. My new problem is trying to delete a key with a nested list, e.g.:JSON:data = {"result":[{"name":"Teddy&q…

Is dot product and normal multiplication results of 2 numpy arrays same?

I am working with kernel PCA in Python and I have to find the values after projecting the original data to the principal components.I use the equation fv = eigvecs[:,:ncomp]print(len(fv))td = fv.T …

Tkinter Entry widget stays empty in larger programs (Python 2)

I want to make a program where, after clicking on a button, a user gets asked for its name, after which the program continues. Im stuck on making the popup return the textstring that has been entered i…

How do i implement this python tree linked list code in dart?

Here is the python codedef tree(root_label, branches=[]):for branch in branches:assert is_tree(branch), branches must be treesreturn [root_label] + list(branches)def label(tree):return tree[0]def branc…

How can i find the ips in network in python

How can i find the TCP ips in network with the range(i.e 132.32.0.3 to 132.32.0.44) through python programming and also want to know the which ips are alive and which are dead. please send me.. thanks …

Python Coding (call function / return values)

I am having trouble writing code for this question. I have seen this question asked in a few places but I still cannot figure out the answer from the tips they provided. The question is: Write a progr…

discord.py Mention user by name

I am trying to mention a user by their name in discord.py. My current code is: @bot.command(name=mention) @commands.has_role(OwnerCommands) async def mention(ctx, *, member: discord.Member):memberid = …

Python unexpected EOF while parsing : syntax error

I am trying to do a simple toto history with a dictionary and function however I have this funny syntax error that keeps appearing that states "unexpected EOF while parsing" on the python she…

How can I read part of file and write the rest to another file?

I have multiple large csv file. How can I read part of each file and write 10% of the data/rows to another file?

Encryption/Decryption - Python GCSE [duplicate]

This question already has an answer here:Encryption and Decryption within the alphabet - Python GCSE(1 answer)Closed 8 years ago.I am currently trying to write a program, for school, in order to encryp…