vendredi 17 avril 2020

Getting error with use of if statement in Python [closed]

I'm a beginner in Python and when I modify the following working piece of code:

    for i in range(ul_buffer_count):
            f.write(str(data_array[i]) + ',')
            write_ch_num += 1
            if write_ch_num == high_chan + 1:
                write_ch_num = low_chan
                f.write(u'\n')

with the one below, I'm getting the error: "SyntaxError: invalid syntax" when I add an additional if as here:

    for i in range(ul_buffer_count):
        if data[i]>0
            f.write(str(data[i]) + ',')
            write_ch_num += 1
            if write_ch_num == h_chan + 1:
                write_ch_num = l_chan
                f.write(u'\n')

What could be the reason for the error?

Aucun commentaire:

Enregistrer un commentaire