0

Hi I was able to get the code working by following the below, but also changing a bunch of variable names seemed to work. Perhaps I was using variables that were recognized by my encoder _UTF-8. Thanks for the help

dt =0.1
a=100
n=int(a/dt)
kgrow=1; kshrink =0.25 
pgrow=kgrow*dt ; 
pshrink=kshrink*dt
length =[] 
l=0
times =[] t=0

for i in range(n):
t+=dt
times.append(t)
randgrow=random.random() 
randshrink=random.random()

length.append(l)

time=np.array(times)
lengths=np.array(length)

plt. plot (times,length)
plt. xlabel('Time')
plt.ylabel('Length') 
  • possible duplicate of [Python "SyntaxError: Non-ASCII character '\xe2' in file"](http://stackoverflow.com/questions/21639275/python-syntaxerror-non-ascii-character-xe2-in-file) – Cory Kramer Dec 05 '14 at 17:58

2 Answers2

0

Try to open it with notepad and save it as ANSI encoding.

Save As.. ANSI Encoding

CodeArtist
  • 5,534
  • 8
  • 40
  • 65
  • Hi Jorge Thanks. However I cannot find ANSI encoding in my mac. I see other kinds of encoding I can save it as, but not this one. Do you have any suggestions? Thank you for your help and quick response... – Joseph Lefty Dec 05 '14 at 19:01
  • Sorry Joseph, i'm not a mac user :( i thought you using windows. Although you may try one of the many online tools like http://i-tools.org/charset – CodeArtist Dec 05 '14 at 23:08
0

Well, probably I had the most issues with encoding.. Here is "ALL" ways to fix it.

First of all import this one to the your .py file.

import locale

locale.setlocale(locale.LC_ALL, '')

After then open the cmd, right click on the title, go preferences.

Choose "Lucida Console" for write type.

Use "u" before your letters. Like x=input(u"Something: ")

There is tons of things I didnt write, first try them my friend.

GLHF
  • 3,835
  • 10
  • 38
  • 83