File handling in Python for beginners
<p>Hello I am new to python and I am encountering this error :</p>

<blockquote>
  <p>C:\Users\Dylan Galea\Desktop\Modelling and CS>python file_handling.py</p>
  
  <p>File "file_handling.py", line 4</p>
  
  <p>np.savetxt(\Users\Dylan Galea\Desktop\Modelling and </p>
  
  <p>CS\test.txt,twoDarray,delimeter='\t')
                                                                                              ^
  SyntaxError: unexpected character after line continuation character</p>
</blockquote>

<p>my code is this :</p>

<pre><code>import numpy as np

twoDarray =np.array([[1,2,3],[4,5,6]])
np.savetxt(\Users\Dylan Galea\Desktop\Modelling and CS\test.txt,twoDarray,delimeter='\t')
</code></pre>

<p>can anyone help please ?</p>

<p>Hi and welcome to StackOverflow. Please use the tools StackOverflow provides to properly structure your post (e.g. mark code etc.) and make sure the indentation and newlines of the Python code is correct since it's part of the syntax. </p>

<p>Regarding the question it's probably an issue with your path which is not marked as string (must be enclosed in quotation marks) and contains backslashes, which are special escape characters in Python. Depending on your operating system (Mac OS, Windows, Linux etc.) you might need to use forward slashes or double(!) backward slashes.</p>

<p>Try this:</p>

<pre><code>twoDarray = np.array([[1,2,3],[4,5,6]])
np.savetxt("/Users/Dylan Galea/Desktop/Modelling and CS/test.txt", twoDarray,delimeter='\t')
</code></pre>

python file numpy