Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7499399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:48:53+00:00 2026-05-29T19:48:53+00:00

I have a big .py file, and I want Python to ignore everything after,

  • 0

I have a big .py file, and I want Python to ignore everything after, say, 15th line…
Something like this:

import this
import that

def foo():
    ...

def foobar():
    ...    

MANUAL_EOF_HERE_SO_DEAR_PYTHON_PLEASE_IGNORE_THE_REST_OF_THIS_FILE

def bar():
    ....

Is there such a thing? Using python 2.7.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T19:48:55+00:00Added an answer on May 29, 2026 at 7:48 pm

    Three choices:

    1. Comment out every line after a certain point by inserting a # at the start of it (which should be easy in your text editor)

    2. Put the entire block of code into a block quote by putting """ at the start and end of it (this won’t work if there are triple-quoted regions within the code) ETA: Better yet, use ''' (triple single quotes)

    3. Use sys.exit() to stop the program at some point (having done import sys earlier). Note that this will stop the code from executing, but will not stop it from being interpreted by Python. Thus, any syntax errors below that line could still cause the program to break.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have this big file of fix length lines. I want to do
How can I replace all line-endings in big file (>100MB)? I have tried to
My config file is really just a big python dict, but I have many
I have a big html file (87000+ lines) and want to delete all occurrences
HI ALL, I have one Big pdf file.Now i want to mark some important
I have an quite big CSv File I want to have in Google Maps
I have a big JSON file, formatted over multiple lines. I want to find
I have a dynamic big File and I want check a Boolean value and
I have a big file, it's expected to be around 12 GB. I want
I have big xls file with formulas and graphics. I want to add some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.