Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Question

Post Timeline

deleted 88 characters in body; edited title
Source Link
petezurich
  • 10.3k
  • 10
  • 48
  • 63

Python convert– Convert string back to list

I am new into Python, and I have a question: I workworking at a "cloud server" for myself. I I have a tool to list files which are on the server.

flist = os.listdir("C:/Server")
conn.send(bytes("str(flist), "UTF-8")) 

This sendsends a list atto the client, the client convertconverts it to a string. (something like this: [' Arcer.exe', 'Launcher.exe', 'Document.txt']) Now how can I convert the string back into a list?

string = "[' Arcer.exe', 'Launcher.exe', 'Document.txt']"
list = []
list = string.convert #pseudo method
print(list[0]) #Arcer.exe
print(list[1]) #Launcher.exe

Sorry for my bad English, I'm a German student

Python convert string back to list

I am new into Python, and I have a question: I work at a "cloud server" for myself. I have a tool to list files which are on the server.

flist = os.listdir("C:/Server")
conn.send(bytes("str(flist), "UTF-8")) 

This send a list at the client, the client convert it to a string. (something like this: [' Arcer.exe', 'Launcher.exe', 'Document.txt']) Now how can I convert the string back into a list?

string = "[' Arcer.exe', 'Launcher.exe', 'Document.txt']"
list = []
list = string.convert #pseudo method
print(list[0]) #Arcer.exe
print(list[1]) #Launcher.exe

Sorry for my bad English, I'm a German student

Python – Convert string to list

I am working at a "cloud server" for myself. I have a tool to list files which are on the server.

flist = os.listdir("C:/Server")
conn.send(bytes("str(flist), "UTF-8")) 

This sends a list to the client, the client converts it to a string. (something like this: [' Arcer.exe', 'Launcher.exe', 'Document.txt']) Now how can I convert the string back into a list?

string = "[' Arcer.exe', 'Launcher.exe', 'Document.txt']"
list = []
list = string.convert #pseudo method
print(list[0]) #Arcer.exe
print(list[1]) #Launcher.exe
edited tags; edited tags
Link
jpp
  • 165.6k
  • 37
  • 301
  • 363
Source Link

Python convert string back to list

I am new into Python, and I have a question: I work at a "cloud server" for myself. I have a tool to list files which are on the server.

flist = os.listdir("C:/Server")
conn.send(bytes("str(flist), "UTF-8")) 

This send a list at the client, the client convert it to a string. (something like this: [' Arcer.exe', 'Launcher.exe', 'Document.txt']) Now how can I convert the string back into a list?

string = "[' Arcer.exe', 'Launcher.exe', 'Document.txt']"
list = []
list = string.convert #pseudo method
print(list[0]) #Arcer.exe
print(list[1]) #Launcher.exe

Sorry for my bad English, I'm a German student

lang-py

AltStyle によって変換されたページ (->オリジナル) /