Skip to content

Magenaut

  • Home
  • Topics
    • Notes
    • Tutorial
    • Bug fixing
    • Extension
    • Server
  • Q&A
  • Privacy Policy
  • About

python-2.x

How can I read large text files line by line, without loading it into memory?

August 21, 2022 by Magenaut

I need to read a large file, line by line. Lets say that file has more than 5GB and I need to read each line, but obviously I do not want to use readlines() because it will create a very large list in the memory.

Categories Python, Q&A Tags python, python-2.x Leave a comment

What is the difference between range and xrange functions in Python 2.X?

August 21, 2022 by Magenaut

Apparently xrange is faster but I have no idea why it’s faster (and no proof besides the anecdotal so far that it is faster) or what besides that is different about

Categories Python, Q&A Tags loops, python, python-2.x, range, xrange Leave a comment

What do numbers starting with 0 mean in python?

August 21, 2022 by Magenaut

When I type small integers with a 0 in front into python, they give weird results. Why is this?

Categories Python, Q&A Tags python, python-2.x Leave a comment

How do I keep Python print from adding newlines or spaces?

August 21, 2022 by Magenaut

first line second line

Categories Python, Q&A Tags formatting, printing, python, python-2.x Leave a comment

What are the differences between the urllib, urllib2, urllib3 and requests module?

August 21, 2022 by Magenaut

In Python, what are the differences between the urllib, urllib2, urllib3 and requests modules? Why are there three? They seem to do the same thing…

Categories Python, Q&A Tags python, python-2.x, python-requests, urllib, urllib2 Leave a comment

What is the difference between dict.items() and dict.iteritems() in Python2?

August 21, 2022 by Magenaut

Are there any applicable differences between dict.items() and dict.iteritems()?

Categories Python, Q&A Tags dictionary, python, python-2.x Leave a comment

How to get string objects instead of Unicode from JSON?

August 21, 2022 by Magenaut

I’m using Python 2 to parse JSON from ASCII encoded text files.

Categories Python, Q&A Tags json, python, python-2.x, serialization, unicode Leave a comment

How to return dictionary keys as a list in Python?

August 21, 2022 by Magenaut

In Python 2.7, I could get dictionary keys, values, or items as a list:

Categories Python, Q&A Tags dictionary, list, python, python-2.x, python-3.x Leave a comment

How to run multiple Python versions on Windows

August 21, 2022 by Magenaut

I had two versions of Python installed on my machine (versions 2.6 and 2.5). I want to run 2.6 for one project and 2.5 for another.

Categories Python, Q&A Tags compatibility, python, python-2.x, python-3.x, windows Leave a comment

Nested arguments not compiling

August 20, 2022 by Magenaut

I’m trying to compile my code into a Python 3 module. It runs fine when I choose “Run module” in IDLE, but receive the following syntax error when I try to create a distribution:

Categories Python, Q&A Tags compatibility, python, python-2.x, python-3.x Leave a comment
Older posts
Newer posts
← Previous Page1 Page2 Page3 … Page7 Next →
  1. michealSmith07 on Is there a way to dynamically refresh the less command?August 21, 2022

    That is a very nice post. I like this post.

  2. anonymous on Fix libwacom9 dependency issue when upgrade DebianJune 27, 2022

    saved my day!! Thanks for the help…

  3. sreedhar on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    Thanks its working

  4. saintnick on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    remove libwacom2 worked for me as well

  5. ranafoul on Fix libwacom9 dependency issue when upgrade DebianApril 22, 2022

    apt remove libwacom2 helped on kali 2022.01. gr8

.net ajax asp.net asp.net-core asp.net-mvc asp.net-mvc-3 asp.net-mvc-4 asp.net-web-api bash c# command-line css custom-post-types custom-taxonomy dataframe dictionary django entity-framework functions gridview html iis javascript jquery json linux list matplotlib numpy pandas php plugin-development plugins posts python python-2.7 python-3.x security shell shell-script sql string vb.net webforms wp-query

© 2026 Magenaut • Built with GeneratePress