简体   繁体   中英

Error: unexpected character after line continuation character

SyntaxError: unexpected character after line continuation character

i get this error at line one in my code

import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib import style

style.use('fivethirtyeight')

fig = plt.figure()
axl = fig.add_subplot(1,1,1)

define animate(i):
    graph_data = open('data.txt', 'r').read()
    lines = graph_data.split('/n')
    xs = []
    ys =[]
    for line in lines:
        if len(line) > 1:
            x, y = line.split(',')
            xs.append(x)
            ys.append(y)

    ax1.clear()        
    ax1.plot(xs, ys)

ani = animation.FuncAnimation(fig, animate, interval=1000)
plt.show()

why?

It's def animate not define animate

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM