Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
remove all comment ?
#1
Question 
Hi everyone,

I would like to remove all the comments in few of my .py files.

I could write a Python program to do so, but maybe someone already write one ? I can't believe that I would be the only one to have this need ?

Thanks.
[Image: NfRQr9R.jpg]
Reply
#2
a quick google search and
https://stackoverflow.com/q/1769332/4046632
https://gist.github.com/BroHui/aca2b8e6e...46c9837fa3

https://www.google.com/search?q=remove+a...om+py+file
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
If you use VSCode there are several plugins that do this.
buran and SpongeB0B like this post
Reply
#4
(Oct-26-2023, 04:21 PM)buran Wrote: a quick google search and
https://stackoverflow.com/q/1769332/4046632
https://gist.github.com/BroHui/aca2b8e6e...46c9837fa3

https://www.google.com/search?q=remove+a...om+py+file

Thank you @buran
I found those trough a www search engine
but none really fit my need, either unnecessary too complex, or have some flaws.

I will look toward the plugins for vscodium if I found something any good.

I will share my finding :)

Cheers.
[Image: NfRQr9R.jpg]
Reply
#5
(Oct-26-2023, 10:23 PM)deanhystad Wrote: If you use VSCode there are several plugins that do this.
Thanks @deanhystad, I've searched for one https://open-vsx.org but found nothing. Have you one name of plugin ?
Pray
[Image: NfRQr9R.jpg]
Reply
#6
I dont't see how tokenizing, removing comment tokens, then untokenizing could fail. It seems that's what @buran 's first link attempts to do. Which flaws does it have?
Reply
#7
Hi @Gribouillis !

I don't see either, but in the following comments (where is located the script) some pp seem to have discover some flaws..

I will try it myself later-on and let you know if it work for me. ( Thanks again @Gribouillis )
[Image: NfRQr9R.jpg]
Reply
#8
If you are using VSCode, click on "Extensions" and type "remove comments" in the "Search Extensions in Marketplace". Lots of choices. I haven't used any of them. Removing comments is not really an issue I have. Writing comments, well...
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to add multi-line comment section? Winfried 1 220 Mar-24-2024, 04:34 PM
Last Post: deanhystad
  Regular Expression search to comment lines of code Gman2233 5 1,700 Sep-08-2022, 06:57 AM
Last Post: ndc85430
  Block comment in Intellij kam_uk 2 2,307 Nov-15-2020, 05:22 PM
Last Post: kam_uk
  Python 3 Elementtree and Comment First gw1500se 3 3,758 May-25-2020, 09:02 PM
Last Post: gw1500se
  Youtube Comment bot mateusz135 4 69,340 Mar-14-2020, 04:18 PM
Last Post: buran
  pdb says "SyntaxError: unexpected EOF" on comment pwannh 1 3,084 Nov-29-2018, 04:17 PM
Last Post: nilamo
  Help extracting comment data from multiple zip files SoulsKeeper 10 6,163 Sep-10-2018, 10:33 AM
Last Post: SoulsKeeper
  python crontab remove_all(comment="Minute*") vvarrior 1 2,778 Aug-06-2018, 12:39 AM
Last Post: Larz60+
  a solo \ at end of comment Skaperen 2 2,651 Jul-22-2018, 10:16 PM
Last Post: Skaperen
  comment indentations Skaperen 12 9,118 Jan-29-2017, 06:56 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020