简体   繁体   中英

In Python, how do I comment out a specific part of the code only?

plt.plot (X, Y, label='xyz1', linewidth=2, linestyle='--', color='red', marker='v')

I don't want to delete linewidth=2, but only comment out that portion, in case I want it for future use. How do I do it?

I tried something like this but it didn't work:

plt.plot (X, Y, label='xyz1', #linewidth=2,\# linestyle='--', color='red', marker='v')

Split out the arguments on separate lines so you can comment them out individually.

plt.plot (
    X, Y,
    label='xyz1',
    # linewidth=2,
    linestyle='--',
    color='red',
    marker='v')

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