Mar-24-2019, 11:44 AM
I am new to Python and any help would be great to learn, I am reading an input line by line into an array list using stdin and the array list looks like this (in a single line): [[1.23, 0.26], [3.10, 0.05], [4.65, 0.30]]. I need to read this array list in the following format with just the space and no commas in it (and with separate lines):
[[1.23 0.26]
[3.10, 0.05]
[4.65, 0.30]]
Can somebody please help how this can be done?
My current code looks like this:
[[1.23 0.26]
[3.10, 0.05]
[4.65, 0.30]]
Can somebody please help how this can be done?
My current code looks like this:
def main(): data = [] for line in sys.stdin.readlines()[1:]: input=list(map(float, line.split())) data.append(input) print(data) if __name__ == "__main__": main()