ERROR BECAUSE OF CAT COMMAND AND !type filename.txt
Title
Question
1.cat primes.txt
<pre style="background-color: transparent; border: 0px none currentcolor; color: black; font-family: monospace; font-size: inherit; line-height: inherit; margin-bottom: 0px; overflow: auto; padding: 1px 0px; vertical-align: baseline;"><span class="ansi-cyan-intense-fg ansi-bold" style="color: rgb(37, 143, 143); font-weight: bold;"> File </span><span class="ansi-green-intense-fg ansi-bold" style="color: rgb(0, 116, 39); font-weight: bold;">"<ipython-input-110-b296f9e207f4>"</span><span class="ansi-cyan-intense-fg ansi-bold" style="color: rgb(37, 143, 143); font-weight: bold;">, line </span><span class="ansi-green-intense-fg ansi-bold" style="color: rgb(0, 116, 39); font-weight: bold;">1</span> <span class="ansi-yellow-intense-fg ansi-bold" style="color: rgb(178, 125, 18); font-weight: bold;"> cat primes.txt</span> <span class="ansi-white-intense-fg ansi-bold" style="color: rgb(161, 166, 178); font-weight: bold;"> ^</span> <span class="ansi-red-intense-fg ansi-bold" style="color: rgb(178, 43, 49); font-weight: bold;">SyntaxError</span><span class="ansi-red-intense-fg ansi-bold" style="color: rgb(178, 43, 49); font-weight: bold;">:</span> invalid syntax </pre>
<span style="background-color: rgb(255, 221, 221); color: black; font-family: monospace; font-size: inherit; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: inherit; overflow-wrap: break-word; white-space: pre-wrap; word-break: break-all;">The system cannot find the file specified.</span>
Python-3.4.3 Loading-Data-From-Files 02-03 min 0-10 sec
Answers:
In case you are using the cat command in the IPython console, please make sure you are using the magic command %cat instead of only using the command cat Also make sure that the file is located in the current directory to which your IPython console is pointing to. If you are on Windows: you can use !type <file-path>/<filename>.txt Example: !type C:/Documents/myfile.txt
Login to add comment