By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,768 Members | 2,054 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,768 IT Pros & Developers. It's quick & easy.

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

bartonc
Expert 5K+
P: 6,596
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
May 28 '07 #1
Share this Question
Share on Google+
11 Replies


bvdet
Expert Mod 2.5K+
P: 2,851
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.
May 28 '07 #2

bartonc
Expert 5K+
P: 6,596
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.
May 28 '07 #3

bartonc
Expert 5K+
P: 6,596
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.
Jun 30 '07 #4

bartonc
Expert 5K+
P: 6,596
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.
Aug 3 '07 #5

latitude
P: 50
ehh...so what happened to my post bartonc???? who deleted it and why??
Aug 14 '07 #6

bartonc
Expert 5K+
P: 6,596
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".
Aug 14 '07 #7

latitude
P: 50
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!
Aug 15 '07 #8

bartonc
Expert 5K+
P: 6,596
Firefox users: Clear your cache for a big surprise!
Aug 26 '07 #9

RedSon
Expert 5K+
P: 5,000
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.
Nov 29 '07 #10

tharden3
100+
P: 916
gracias for the tip. I just got firefox (well, I got Ubuntu with firefox) so thanks.
Jul 9 '08 #11

P: 11
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.
Aug 10 '08 #12

Post your reply

Sign in to post your reply or Sign up for a free account.