I used !type it works in place on cat and loadtxt but do not able to print (primes) please help
Title
Question
In [3]: ! type C:\Users\91877\Downloads\primes.txt
2
3
5
7
11
13
17
19
23
29
31
37
41
43
47
53
59
61
67
71
73
79
83
89
97
In [4]: primes = !type("C:\Users\91877\Downloads\primes.txt")
In [5]: print(primes)
['The filename, directory name, or volume label syntax is incorrect.']
Python-3.4.3 Loading-Data-From-Files 02-03 min 50-60 sec
Answers:
Please keep the file in the current working directory and try the !type command. To check the current working directory from python type %pwd.
Login to add comment