<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: IIS ANISA</title>
    <description>The latest articles on DEV Community by IIS ANISA (@iis_anisa_de29b4791a3a4c8).</description>
    <link>https://dev.to/iis_anisa_de29b4791a3a4c8</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2964167%2Fb77ae784-1d00-44d6-94df-abbbbb3534bc.png</url>
      <title>DEV Community: IIS ANISA</title>
      <link>https://dev.to/iis_anisa_de29b4791a3a4c8</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/iis_anisa_de29b4791a3a4c8"/>
    <language>en</language>
    <item>
      <title>argument passing in python</title>
      <dc:creator>IIS ANISA</dc:creator>
      <pubDate>Fri, 21 Mar 2025 18:37:32 +0000</pubDate>
      <link>https://dev.to/iis_anisa_de29b4791a3a4c8/argument-passing-in-python-f65</link>
      <guid>https://dev.to/iis_anisa_de29b4791a3a4c8/argument-passing-in-python-f65</guid>
      <description>&lt;p&gt;in python when you execute your python files using interactive mode in python you could also pass the argument by adding it alongside with the filenames that you want to execute for example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python tes.py 1 2 3 yes no
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you can get the list of argument above in the code by using lib built in form python called sys.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import sys
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you can call all of the argument that you pass when you execute the files by using this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import sys

print(sys.argv)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;by excuting above code you will get all of the argument include the file name into the list.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;['tes.py',1,2,3,'yes','no']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or you could access name file only by using code bellow, because by default files name always placed in the first list.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print(sys.argv[0])
#it will return--&amp;gt;tes.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>python</category>
      <category>learncode</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
