Answers for "text to python list"

1

txt to list python

with open('names.txt', 'r') as f:
    myNames = [line.strip() for line in f]
Posted by: Guest on July-11-2021
0

list to text python

# Turn the list into a literal string:
s = ['I', 'want', 4, 'apples', 'and', 18, 'bananas'] 
# will return: "['I', 'want', 4, 'apples', 'and', 18, 'bananas']"
print(str(s))
Posted by: Guest on November-24-2021

Code answers related to "text to python list"

Python Answers by Framework

Browse Popular Code Answers by Language