omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Help: Pythonista doesn't have same output as IDLE?

    Pythonista
    3
    7
    2016
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • SkiNoCap
      SkiNoCap last edited by

      I downloaded Pythonista on my iPad for a college course I'm taking, figuring it would be an easy way to fit my assignments into my workflow. Up comes an assignment where we have to align multiple lines of code.

      First issue, but one that isn't too relevant here, but maybe someone can help anyway, is I can't do multi-line strings in Pythonista (so it appears). Second, and bigger, problem is that Pythonista's command line output differs greatly from IDLE's. My teacher graded my assignment and told me that my lines are all out of line and I got docked for it when in Pythonista it was perfectly in line.

      My question is, why is Pythonista not basically a copy of IDLE and how can I work around it (if there is a workaround) using only my iPad?

      JonB 1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by

        Do you have an example of the Pythonista vs IDLE output? (a sequence of commands and what it is supposed to look like vs what it does look like?)

        Is your assignment to run a script, and take the printed output from the console and copy it to a text file? Or type interactive commands in the console? (In which case you want the >>>'s?)

        How are you copying your text from the pythonista console? Are you just copying it into a .txt file in pythonista? Or into an email or something?

        Copying from pythonista console to a pythonista text document ought to work. Copying into another app probably might screw with spacing, especially if not using a fixed spacing font.

        If you are trying to replicate IDLE output, you might be able to write a little program that takes a line at a time of a file, outputs the >>>'s and redirects stdout. Let us know what you are trying to actually achieve.

        1 Reply Last reply Reply Quote 0
        • JonB
          JonB @SkiNoCap last edited by

          @SkiNoCap btw, you can do multiline strings in the editor. Likely, you cannot do them in the console (although triple quoted string might...I forget)

          1 Reply Last reply Reply Quote 0
          • SkiNoCap
            SkiNoCap last edited by

            @JonB the assignment required a .py file which would, when run in IDLE, output a business card-esque ASCII style image. I posed the same question over on StackOverflow and I was directed to use spaces instead of tabs (which are different sizes in different places), which did work (in Pyto and Pythonista at least, don't have access to IDLE currently). I have been using the text editor to create my files, not the console.

            Here is a copy of my original code with tabs:

            print("+------------------------------------------------+")
            print("|    |\t\t\t                                    |")
            print("|   -|\t\t\t   Zielinski, Michael               |")
            print("|  --|\t\t\t   Tribute Liabilities Associate    |")
            print("| ---|\t\t\t   Parasail Capital                 |")
            print("| ---------\t                                    |")
            print("|  -------\t   4 Hunger Plaza                   |")
            print("|\t\t\t\t   STE 1400                         |")
            print("|\t\t\t\t   District 12, Panem 00012         |")
            print("|\t\t\t\t                                    |")
            print("| Work: (406)-214-1165\t@: michael@parasail.com   |")
            print("+------------------------------------------------+")
            1 Reply Last reply Reply Quote 0
            • SkiNoCap
              SkiNoCap last edited by

              @JonB also is there a way to edit the tab sizes in Pythonista? I'm am really new to programming, as I've said, and don't really know all the features.

              JonB 1 Reply Last reply Reply Quote 0
              • ccc
                ccc last edited by

                I was directed to use spaces instead of tabs

                That is always a good idea in Python.

                1 Reply Last reply Reply Quote 0
                • JonB
                  JonB @SkiNoCap last edited by

                  @SkiNoCap in the settings menu, keyboard and indentation, you can control whether pythonista uses tabs or spaces when hit tab, and whether to use 3 or 4 spaces.

                  Tabs are good for retaining semantic meaning, but not great for actually formatting with a specific format in mind. In other words, tabs are good for storing data, but usually not for display.

                  The idea of tabs for indentation is good -- similar to the way xml allows for device independent storing of data, which can then be rendered in a way that makes sense (say, small devices could use smaller spaces, or formatting into tabular format, etc)

                  But the reality is that many editors don't properly support tabs, and it is usually hard to tell the difference between spaces and tabs, so your safest bet is to set pythonista to replace tabs with 3 or 4 spaces depending on your aesthetic.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Powered by NodeBB Forums | Contributors