May-04-2020, 12:54 PM
(May-04-2020, 12:46 PM)TomToad Wrote:text = '''******F**** *****W*****''' print ("text =",text) ls = text.splitlines() print ("ls =",ls) ls2 = [[letter for letter in line] for line in ls] print ("ls2 =",ls2)
could i apply this to a text file ill send you the code i have for that
def read_lines(filename): try: file = open(filename, 'r') readfile = file.readlines() return list(readfile) except FileNotFoundError: return "{} does not exist!".format(filename)and the file the code opens contains this
**X**
* *
**Y**