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 721119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:50:13+00:00 2026-05-14T05:50:13+00:00

I’m trying to get the def wfsc_pod1 and wfsc_ip into the same def. I’m

  • 0

I’m trying to get the def wfsc_pod1 and wfsc_ip into the same def. I’m not quite sure how to approach the problem. I want wfsc_pod1 to display all the information for name, subnet and gateway. Then wfsc_ip shows the ip addresses below it. I also get a None value when I run it as it. Not sure why. Anything more pythonic is more appreciated.

class OutageAddress:
    subnet = ["255.255.255.0", "255.255.255.1"]

    # Gateway order is matched with names
    gateway = ["192.168.1.1", "192.168.1.2", "192.168.1.3", "192.168.1.4",
                "192.168.1.5", "192.168.1.6", "192.168.1.7", "192.168.1.8",
                "192.168.1.9"]

    name = ["LOC1", "LOC2", "LOC3", "LOC4",
                "LOC5", "LOC6", "LOC7", "LOC8",
                "LOC9"]

    def wfsc_pod1(self):
        wfsc_1 = "%s\t %s\t %s\t" % (network.name[0],network.subnet[0],network.gateway[0])
        return wfsc_1

    def wfsc_ip(self):
        for ip in range(100,110):
            ip = "192.168.1."+str(ip)
            print ip

network = OutageAddress()
print network.wfsc_pod1()
print network.wfsc_ip()
  • 1 1 Answer
  • 2 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-14T05:50:14+00:00Added an answer on May 14, 2026 at 5:50 am

    First of all, you probably meant to write wfsc_pod1 like this:

    def wfsc_pod1(self):
        return "%s\t%s\t%s" % (self.name[0], self.subnet[0], self.gateway[0])
    

    and call wfsc_ip like this:

    network.wfsc_ip() # no print
    

    If you want to combine wfsc_pod1 and wfsc_ip, you can do this:

    def wfsc_combined(self):
        output = []
        output.append("%s\t%s\t%s" % (self.name[0], self.subnet[0], self.gateway[0]))
        for ip in range(100,110):
            output.append("192.168.1.%d" % ip)
        return '\n'.join(output)
    

    and call this function with a print statement.

    However, a better approach (IMO) would be to add print statements inside wfsc_combined and call it without a print statement:

    def wfsc_combined(self):
        print "%s\t%s\t%s" % (self.name[0], self.subnet[0], self.gateway[0])
        for ip in range(100,110):
            print "192.168.1.%d" % ip
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
i want to parse a xhtml file and display in UITableView. what is the
I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you
Basically, what I'm trying to create is a page of div tags, each has
I want to count how many characters a certain string has in PHP, but

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.