Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

New (Firefox)!!! Instructions for copying code from these threads (also IE)

Question posted by: bartonc (Site Moderator) on May 28th, 2007 06:33 PM
If you are using Firefox as you browser, you'll probably have discovered that the new-style [code] tags don't allow you to copy posted code without an annoying "#" on every other line.
In order for you to get the raw text of the posted code, just hit the "Reply" button, copy what's between the tags and browse "Back" to the OP.

Hope that helps,
Barton
bvdet's Avatar
bvdet
Expert
1,147 Posts
May 28th, 2007
06:59 PM
#2

Re: New (Firefox)!!! Instructions for copying code from these threads (also IE)
I have been saving the copied code to a text file and running this script:
Expand|Select|Wrap|Line Numbers
  1. fn = 'script.txt'
  2. outFile = 'script.py'
  3.  
  4. f = open(fn)
  5. fList = [line.rstrip()[6:] for line in f]
  6. f.close()
  7.  
  8. f=open(outFile, 'w')
  9. f.write('\n'.join([i for i in fList if i != '']))
  10. f.close()
Thanks for the tip, Barton. That will be easier.

Reply
bartonc's Avatar
bartonc
Site Moderator
6,399 Posts
May 28th, 2007
07:47 PM
#3

Re: New (Firefox)!!! Instructions for copying code from these threads (also IE)
Quote:
I have been saving the copied code to a text file and running this script:
Expand|Select|Wrap|Line Numbers
  1. fn = 'script.txt'
  2. outFile = 'script.py'
  3.  
  4. f = open(fn)
  5. fList = [line.rstrip()[6:] for line in f]
  6. f.close()
  7.  
  8. f=open(outFile, 'w')
  9. f.write('\n'.join([i for i in fList if i != '']))
  10. f.close()
Thanks for the tip, Barton. That will be easier.

You are welcome. The funny thing is (living in relative isolation from eachother, as we do), I didn't think that this would really affect many users. I'm glad to know that a simple IE user can come up with solutions to other's problems.

Thanks for the script, too. I've quoted you over on the Feedback Forum. It'll be interesting to see other's reactions.

Reply
bartonc's Avatar
bartonc
Site Moderator
6,399 Posts
June 30th, 2007
08:22 PM
#4

Re: New (Firefox)!!! Instructions for copying code from these threads (also IE)
Quote:
If you are using Firefox as you browser, you'll probably have discovered that the new-style [ code ] tags don't allow you to copy posted code without an annoying "#" on every other line.
In order for you to get the raw text of the posted code, just hit the "Reply" button, copy what's between the tags and browse "Back" to the OP.

Hope that helps,
Barton

I now looks as if these instructions apply to everybody. Long lines like:
Expand|Select|Wrap|Line Numbers
  1.     print '*************************************************  ****************'

get spaces added in some weird place. I remember having this problem in IE a long time ago.

Reply
bartonc's Avatar
bartonc
Site Moderator
6,399 Posts
August 3rd, 2007
09:43 AM
#5

Re: New (Firefox)!!! Instructions for copying code from these threads (also IE)
If found the coolest solution for Firefox users who regularly visit sites that work poorly (or won't work at all - like Window Update) on Firefox!

Just go get ietab for firefox.
It works very well, but you do lose the spell checker.

Reply
latitude's Avatar
latitude
Member
51 Posts
August 14th, 2007
09:03 AM
#6

Re: New (Firefox)!!! Instructions for copying code from these threads (also IE)
ehh...so what happened to my post bartonc???? who deleted it and why??

Reply
bartonc's Avatar
bartonc
Site Moderator
6,399 Posts
August 14th, 2007
08:32 PM
#7

Re: New (Firefox)!!! Instructions for copying code from these threads (also IE)
Quote:
ehh...so what happened to my post bartonc???? who deleted it and why??

Do you mean the one in this thread? I split it out to separate the issues being discussed. It was easy to find: Click you name (link to profile) click "find all posts be latitude".

Reply
latitude's Avatar
latitude
Member
51 Posts
August 15th, 2007
06:59 AM
#8

Re: New (Firefox)!!! Instructions for copying code from these threads (also IE)
Ah right, thanks for clearing that up...

Thats such a nice feature it really should be in the control panel - makes life abit more easier!

Reply
bartonc's Avatar
bartonc
Site Moderator
6,399 Posts
August 26th, 2007
07:58 PM
#9

Re: New (Firefox)!!! Instructions for copying code from these threads (also IE)
Firefox users: Clear your cache for a big surprise!

Reply
RedSon's Avatar
RedSon
Site Moderator
2,917 Posts
November 29th, 2007
05:04 PM
#10

Re: New (Firefox)!!! Instructions for copying code from these threads (also IE)
Quote:
Firefox users: Clear your cache for a big surprise!


I did that but my toaster exploded! You are evil Barton, pure evil! Now I need to buy a new toaster.

Reply
tharden3's Avatar
tharden3
Needs Regular Fix
509 Posts
July 9th, 2008
07:10 PM
#11

Re: New (Firefox)!!! Instructions for copying code from these threads (also IE)
gracias for the tip. I just got firefox (well, I got Ubuntu with firefox) so thanks.

Reply
Formula's Avatar
Formula
Newbie
7 Posts
August 10th, 2008
08:51 PM
#12

Re: New (Firefox)!!! Instructions for copying code from these threads (also IE)
Hi everyone,I used to copy the code.
After that, opening Kwrite on linux.
Then, press Ctrl + R search with regex and put this regex
\s\s+\d+[.]+\n+\s{6}
then replace all.

Reply
Reply
Not the answer you were looking for? Post your question . . .
189,816 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
Top Python Forum Contributors