Why it prints elements after leaving a space at the beginning of the new line?Get list from server and print each element surrounded by span tagHow to sort contents in a file in pythonEnthought Canopy does not read data from or write data to csv files for PythonPython carriage returnhow to use while loop without infinite loop(python 2.7)How to create loop to scrape data from a column from a wikipedia table?Combine two differently sized lists into a combined setHow to Print in Python 2.7 without newline without bufferingScraping skips some of the page url and does not write all values in CSVHow do I fix invalid syntax error when importing postgis in Python 2.7?

What makes "quality" analog AV cables better than cheap cables?

Tikz draw contour without some edges, and fill

How can I answer high-school writing prompts without sounding weird and fake?

How do I tell my supervisor that he is choosing poor replacements for me while I am on maternity leave?

Does SQL Server allow (make visible) DDL inside a transaction to the transaction prior to commit?

What kind of SATA connector is this?

Forgoing Enlightenment

Jesus' words on the Jews

Why was Thor doubtful about his worthiness to Mjolnir?

Area under the curve - Integrals (Antiderivatives)

How to cope with regret and shame about not fully utilizing opportunities during PhD?

Wireless headphones interfere with Wi-Fi signal on laptop

Was this character’s old age look CGI or make-up?

How can a layman easily get the consensus view of what academia *thinks* about a subject?

Is the expression "To think you would stoop so low" often misused?

Find hamming distance between two Strings of equal length in Java

Is it possible to create different colors in rocket exhaust?

Longest Text in Latin

what does a native speaker say when he wanted to leave his work?

Is there anything special about -1 (0xFFFFFFFF) regarding ADC?

Why is a set not a partition of itself?

Is 12 minutes connection in Bristol Temple Meads long enough?

Why does my circuit work on a breadboard, but not on a perfboard? I am new to soldering

Non-deterministic Finite Automata | Sipser Example 1.16



Why it prints elements after leaving a space at the beginning of the new line?


Get list from server and print each element surrounded by span tagHow to sort contents in a file in pythonEnthought Canopy does not read data from or write data to csv files for PythonPython carriage returnhow to use while loop without infinite loop(python 2.7)How to create loop to scrape data from a column from a wikipedia table?Combine two differently sized lists into a combined setHow to Print in Python 2.7 without newline without bufferingScraping skips some of the page url and does not write all values in CSVHow do I fix invalid syntax error when importing postgis in Python 2.7?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am using python 2.7



this is a very easy code:



from __future__ import print_function
my_list = [1,2,3,4]

for i in my_list:
# print(i)
print(i, end="n ")
# print(i)


when I print this loop by:



print(i, end="n ")


output:



1
2
3
4


how to solve this issue using this mothed not print(i) becuase I collect data by the robot without for_loop. So, I use this code for simplicity



when I need to write the data in the file, I am using end="n "



it is leaving a space at the beginning of the new line



please help me or any suggestion



thank you in advance










share|improve this question






























    0















    I am using python 2.7



    this is a very easy code:



    from __future__ import print_function
    my_list = [1,2,3,4]

    for i in my_list:
    # print(i)
    print(i, end="n ")
    # print(i)


    when I print this loop by:



    print(i, end="n ")


    output:



    1
    2
    3
    4


    how to solve this issue using this mothed not print(i) becuase I collect data by the robot without for_loop. So, I use this code for simplicity



    when I need to write the data in the file, I am using end="n "



    it is leaving a space at the beginning of the new line



    please help me or any suggestion



    thank you in advance










    share|improve this question


























      0












      0








      0








      I am using python 2.7



      this is a very easy code:



      from __future__ import print_function
      my_list = [1,2,3,4]

      for i in my_list:
      # print(i)
      print(i, end="n ")
      # print(i)


      when I print this loop by:



      print(i, end="n ")


      output:



      1
      2
      3
      4


      how to solve this issue using this mothed not print(i) becuase I collect data by the robot without for_loop. So, I use this code for simplicity



      when I need to write the data in the file, I am using end="n "



      it is leaving a space at the beginning of the new line



      please help me or any suggestion



      thank you in advance










      share|improve this question
















      I am using python 2.7



      this is a very easy code:



      from __future__ import print_function
      my_list = [1,2,3,4]

      for i in my_list:
      # print(i)
      print(i, end="n ")
      # print(i)


      when I print this loop by:



      print(i, end="n ")


      output:



      1
      2
      3
      4


      how to solve this issue using this mothed not print(i) becuase I collect data by the robot without for_loop. So, I use this code for simplicity



      when I need to write the data in the file, I am using end="n "



      it is leaving a space at the beginning of the new line



      please help me or any suggestion



      thank you in advance







      python-2.7






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 23 at 13:33







      REDHWAN AL-GABRI

















      asked Mar 23 at 13:18









      REDHWAN AL-GABRIREDHWAN AL-GABRI

      84




      84






















          1 Answer
          1






          active

          oldest

          votes


















          0














          The extra space is due to the space you passed in end argument in print function.
          instead of print(i, end="n ")
          useprint(i, end="n")
          Remember that whatever you pass inside double quotes will be displayed as it is on the terminal, so remove that extra space in "n ".






          share|improve this answer























          • thank you so so much, I don't focus about this wrong, it is fine now

            – REDHWAN AL-GABRI
            Mar 23 at 13:35












          • you're welcome!

            – Shivam Singh
            Mar 23 at 13:38











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55314125%2fwhy-it-prints-elements-after-leaving-a-space-at-the-beginning-of-the-new-line%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          The extra space is due to the space you passed in end argument in print function.
          instead of print(i, end="n ")
          useprint(i, end="n")
          Remember that whatever you pass inside double quotes will be displayed as it is on the terminal, so remove that extra space in "n ".






          share|improve this answer























          • thank you so so much, I don't focus about this wrong, it is fine now

            – REDHWAN AL-GABRI
            Mar 23 at 13:35












          • you're welcome!

            – Shivam Singh
            Mar 23 at 13:38















          0














          The extra space is due to the space you passed in end argument in print function.
          instead of print(i, end="n ")
          useprint(i, end="n")
          Remember that whatever you pass inside double quotes will be displayed as it is on the terminal, so remove that extra space in "n ".






          share|improve this answer























          • thank you so so much, I don't focus about this wrong, it is fine now

            – REDHWAN AL-GABRI
            Mar 23 at 13:35












          • you're welcome!

            – Shivam Singh
            Mar 23 at 13:38













          0












          0








          0







          The extra space is due to the space you passed in end argument in print function.
          instead of print(i, end="n ")
          useprint(i, end="n")
          Remember that whatever you pass inside double quotes will be displayed as it is on the terminal, so remove that extra space in "n ".






          share|improve this answer













          The extra space is due to the space you passed in end argument in print function.
          instead of print(i, end="n ")
          useprint(i, end="n")
          Remember that whatever you pass inside double quotes will be displayed as it is on the terminal, so remove that extra space in "n ".







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 23 at 13:28









          Shivam SinghShivam Singh

          579




          579












          • thank you so so much, I don't focus about this wrong, it is fine now

            – REDHWAN AL-GABRI
            Mar 23 at 13:35












          • you're welcome!

            – Shivam Singh
            Mar 23 at 13:38

















          • thank you so so much, I don't focus about this wrong, it is fine now

            – REDHWAN AL-GABRI
            Mar 23 at 13:35












          • you're welcome!

            – Shivam Singh
            Mar 23 at 13:38
















          thank you so so much, I don't focus about this wrong, it is fine now

          – REDHWAN AL-GABRI
          Mar 23 at 13:35






          thank you so so much, I don't focus about this wrong, it is fine now

          – REDHWAN AL-GABRI
          Mar 23 at 13:35














          you're welcome!

          – Shivam Singh
          Mar 23 at 13:38





          you're welcome!

          – Shivam Singh
          Mar 23 at 13:38



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55314125%2fwhy-it-prints-elements-after-leaving-a-space-at-the-beginning-of-the-new-line%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript