<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Starwise</title>
    <link>https://starwise.tistory.com/</link>
    <description></description>
    <language>ko</language>
    <pubDate>Thu, 3 Sep 2026 04:37:22 +0900</pubDate>
    <generator>TISTORY</generator>
    <ttl>100</ttl>
    <managingEditor>Starwise</managingEditor>
    <item>
      <title>[Pytorch] label을 one-hot vector로 만드는 함수</title>
      <link>https://starwise.tistory.com/6</link>
      <description>&lt;pre id=&quot;code_1625485834071&quot; class=&quot;python&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;def one_hot_embedding(labels, num_classes):
    &quot;&quot;&quot;Embedding labels to one-hot form.

    Args:
      labels: (LongTensor) class labels, sized [N,].
      num_classes: (int) number of classes.

    Returns:
      (tensor) encoded labels, sized [N, #classes].
    &quot;&quot;&quot;
    y = torch.eye(num_classes) 
    return y[labels]&lt;/code&gt;&lt;/pre&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;출처 : &lt;a href=&quot;https://discuss.pytorch.org/t/convert-int-into-one-hot-format/507/25&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://discuss.pytorch.org/t/convert-int-into-one-hot-format/507/25&lt;/a&gt;&lt;/p&gt;</description>
      <author>Starwise</author>
      <guid isPermaLink="true">https://starwise.tistory.com/6</guid>
      <comments>https://starwise.tistory.com/6#entry6comment</comments>
      <pubDate>Mon, 5 Jul 2021 20:51:13 +0900</pubDate>
    </item>
    <item>
      <title>[Python]경로 상에 폴더 생성하기</title>
      <link>https://starwise.tistory.com/4</link>
      <description>&lt;div class=&quot;colorscripter-code&quot; style=&quot;color:#010101; font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; position:relative !important; overflow:auto&quot;&gt;&lt;p&gt;&lt;p&gt;&lt;div class=&quot;colorscripter-code&quot; style=&quot;overflow: auto; position: relative !important;&quot;&gt;&lt;/div&gt;&lt;/p&gt;&lt;table class=&quot;colorscripter-code-table&quot; style=&quot;margin:0; padding:0; border:none; background-color:#fafafa; border-radius:4px;&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;&lt;/table&gt;&lt;/p&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;padding:6px; border-right:2px solid #e5e5e5&quot;&gt;&lt;div style=&quot;margin:0; padding:0; word-break:normal; text-align:right; color:#666; font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height:130%&quot;&gt;&lt;div style=&quot;line-height:130%&quot;&gt;1&lt;/div&gt;&lt;div style=&quot;line-height:130%&quot;&gt;2&lt;/div&gt;&lt;div style=&quot;line-height:130%&quot;&gt;3&lt;/div&gt;&lt;div style=&quot;line-height:130%&quot;&gt;4&lt;/div&gt;&lt;div style=&quot;line-height:130%&quot;&gt;5&lt;/div&gt;&lt;div style=&quot;line-height:130%&quot;&gt;6&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;padding:6px 0&quot;&gt;&lt;div style=&quot;margin:0; padding:0; color:#010101; font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height:130%&quot;&gt;&lt;div style=&quot;padding:0 6px; white-space:pre; line-height:130%&quot;&gt;&lt;span style=&quot;color:#a71d5d&quot;&gt;import&lt;/span&gt;&amp;nbsp;os&lt;/div&gt;&lt;div style=&quot;padding:0 6px; white-space:pre; line-height:130%&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;padding:0 6px; white-space:pre; line-height:130%&quot;&gt;path&amp;nbsp;&lt;span style=&quot;color:#0086b3&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color:#a71d5d&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color:#63a35c&quot;&gt;&quot;/mypath&quot;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;padding:0 6px; white-space:pre; line-height:130%&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;padding:0 6px; white-space:pre; line-height:130%&quot;&gt;&lt;span style=&quot;color:#a71d5d&quot;&gt;if&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color:#a71d5d&quot;&gt;not&lt;/span&gt;(os.path.isdir(path))&amp;nbsp;:&lt;/div&gt;&lt;div style=&quot;padding:0 6px; white-space:pre; line-height:130%&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;os.makedirs(os.path.join(path))&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;vertical-align:bottom; padding:0 2px 4px 0&quot;&gt;&lt;a href=&quot;http://colorscripter.com/info#e&quot; target=&quot;_blank&quot; style=&quot;text-decoration:none; color:white&quot;&gt;&lt;span style=&quot;font-size:9px; word-break:normal; background-color:#e5e5e5; color:white; border-radius:10px; padding:1px&quot;&gt;cs&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;os.path.isdir은 해당 경로에 폴더가 있는 지 확인하는 함수이고&lt;/p&gt;&lt;p&gt;os.makedirs는 해당 경로를 생성하는 함수이며&lt;/p&gt;&lt;p&gt;os.path.join은 args를 합쳐 하나의 경로로 생성하는 함수이다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;참고로, os.path.isdir은 해당 경로에 '폴더'만 있는 지 확인한다.&lt;/p&gt;&lt;p&gt;만약 폴더가 아니라 파일이 있는지 확인하고자 한다면, os.path.exists나 os.path.isfile를 사용한다.&lt;/p&gt;</description>
      <category>Programming/Python</category>
      <category>Programming</category>
      <category>Python</category>
      <author>Starwise</author>
      <guid isPermaLink="true">https://starwise.tistory.com/4</guid>
      <comments>https://starwise.tistory.com/4#entry4comment</comments>
      <pubDate>Tue, 11 Dec 2018 13:31:38 +0900</pubDate>
    </item>
    <item>
      <title>[Python] '01', '001', '0001', ... 등으로 저장하는 법</title>
      <link>https://starwise.tistory.com/3</link>
      <description>&lt;div class=&quot;colorscripter-code&quot; style=&quot;color: rgb(1, 1, 1); white-space: pre; font-size: 12px; overflow: auto; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace !important; position: relative !important;&quot;&gt;&lt;div class=&quot;colorscripter-code&quot; style=&quot;overflow: auto; position: relative !important;&quot;&gt;&lt;span style=&quot;font-size: 18pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;1. 함수 사용법&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;colorscripter-code&quot; style=&quot;overflow: auto; position: relative !important;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;colorscripter-code&quot; style=&quot;overflow: auto; position: relative !important;&quot;&gt;아래와 같은 포멧을 사용하면 된다.&lt;/div&gt;&lt;div class=&quot;colorscripter-code&quot; style=&quot;overflow: auto; position: relative !important;&quot;&gt;이 때, a는 보통 integer형을 입력한다.&lt;/div&gt;&lt;div class=&quot;colorscripter-code&quot; style=&quot;overflow: auto; position: relative !important;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;colorscripter-code&quot; style=&quot;overflow: auto; position: relative !important;&quot;&gt;&lt;div class=&quot;colorscripter-code&quot; style=&quot;overflow: auto; position: relative !important;&quot;&gt;&lt;table class=&quot;colorscripter-code-table&quot; style=&quot;margin:0; padding:0; border:none; background-color:#fafafa; border-radius:4px;&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;padding:6px; border-right:2px solid #e5e5e5&quot;&gt;&lt;div style=&quot;margin:0; padding:0; word-break:normal; text-align:right; color:#666; font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height:130%&quot;&gt;&lt;div style=&quot;line-height:130%&quot;&gt;1&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;padding:6px 0&quot;&gt;&lt;div style=&quot;margin:0; padding:0; color:#010101; font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height:130%&quot;&gt;&lt;div style=&quot;padding:0 6px; white-space:pre; line-height:130%&quot;&gt;'{0:02}'.format(a)&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;vertical-align:bottom; padding:0 2px 4px 0&quot;&gt;&lt;a href=&quot;http://colorscripter.com/info#e&quot; target=&quot;_blank&quot; style=&quot;color: white;&quot;&gt;&lt;span style=&quot;font-size: 9px; word-break: normal; background-color: rgb(229, 229, 229); border-radius: 10px; padding: 1px;&quot;&gt;cs&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre; font-size: 12px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre; font-size: 12px;&quot;&gt;여기서, &lt;b&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;0:02의 2는 String형의 결과값의 길이&lt;/span&gt;&lt;/b&gt;를 뜻하고, &lt;b&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;결과는 String형&lt;/span&gt;&lt;/b&gt;으로 출력된다.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre; font-size: 12px;&quot;&gt;아래는 기본적인 예시이다.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre; font-size: 12px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;colorscripter-code&quot; style=&quot;color:#010101; font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; position:relative !important; overflow:auto&quot;&gt;&lt;table class=&quot;colorscripter-code-table&quot; style=&quot;margin:0; padding:0; border:none; background-color:#fafafa; border-radius:4px;&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;padding:6px; border-right:2px solid #e5e5e5&quot;&gt;&lt;div style=&quot;margin:0; padding:0; word-break:normal; text-align:right; color:#666; font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height:130%&quot;&gt;&lt;div style=&quot;line-height:130%&quot;&gt;1&lt;/div&gt;&lt;div style=&quot;line-height:130%&quot;&gt;2&lt;/div&gt;&lt;div style=&quot;line-height:130%&quot;&gt;3&lt;/div&gt;&lt;div style=&quot;line-height:130%&quot;&gt;4&lt;/div&gt;&lt;div style=&quot;line-height:130%&quot;&gt;5&lt;/div&gt;&lt;div style=&quot;line-height:130%&quot;&gt;6&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;padding:6px 0&quot;&gt;&lt;div style=&quot;margin:0; padding:0; color:#010101; font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; line-height:130%&quot;&gt;&lt;div style=&quot;padding:0 6px; white-space:pre; line-height:130%&quot;&gt;a&amp;nbsp;=&amp;nbsp;1&lt;/div&gt;&lt;div style=&quot;padding:0 6px; white-space:pre; line-height:130%&quot;&gt;'{0:02}'.format(a)&amp;nbsp;=&amp;nbsp;'01'&lt;/div&gt;&lt;div style=&quot;padding:0 6px; white-space:pre; line-height:130%&quot;&gt;b&amp;nbsp;=&amp;nbsp;3&lt;/div&gt;&lt;div style=&quot;padding:0 6px; white-space:pre; line-height:130%&quot;&gt;'{0:03}'.format(b)&amp;nbsp;=&amp;nbsp;'003'&lt;/div&gt;&lt;div style=&quot;padding:0 6px; white-space:pre; line-height:130%&quot;&gt;c&amp;nbsp;=&amp;nbsp;4&lt;/div&gt;&lt;div style=&quot;padding:0 6px; white-space:pre; line-height:130%&quot;&gt;'{0:04}'.format(c)&amp;nbsp;=&amp;nbsp;'0003'&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;vertical-align:bottom; padding:0 2px 4px 0&quot;&gt;&lt;a href=&quot;http://colorscripter.com/info#e&quot; target=&quot;_blank&quot; style=&quot;color: white;&quot;&gt;&lt;span style=&quot;font-size: 9px; word-break: normal; background-color: rgb(229, 229, 229); border-radius: 10px; padding: 1px;&quot;&gt;cs&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre; font-size: 12px;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0); font-size: 18pt;&quot;&gt;2. 사용처&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre;&quot;&gt;
&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre; font-size: 12px;&quot;&gt;&lt;span style=&quot;font-size: 8pt;&quot;&gt;주 사용처&lt;/span&gt;는 &lt;span style=&quot;font-size: 14pt;&quot;&gt;&lt;b&gt;Training Dataset을 저장 및 불러오기&lt;/b&gt;&lt;/span&gt;할 때 사용한다.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre;&quot;&gt;
&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre; font-size: 12px;&quot;&gt;인터넷에 배포되고 있는 Dataset들은 0001.png, 0002.png ... 이런 식으로 저장되어 있는 경우가 많고,&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre;&quot;&gt;
&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre; font-size: 12px;&quot;&gt;이 경우 데이터들을 for문을 통해 쉽게 불러올 수 있다.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre;&quot;&gt;
&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre; font-size: 12px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre;&quot;&gt;
&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre; font-size: 12px;&quot;&gt;반대로, 내가 데이터셋을 생성하는 경우에도 같은 형식으로 만드는 것이 유리한데,&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre;&quot;&gt;
&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre; font-size: 12px;&quot;&gt;그 이유는 &lt;span style=&quot;font-size: 14pt;&quot;&gt;&lt;b&gt;Data Parsing하기가 쉬워지기&lt;/b&gt;&lt;/span&gt; 때문이다.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre;&quot;&gt;
&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre; font-size: 12px;&quot;&gt;파일명이나 경로명이 어떤 정보를 가지고 있는 경우, 경로에 포함된 정보들로 Data Parsing을 할 수 있고, &lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre;&quot;&gt;
&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre; font-size: 12px;&quot;&gt;이 때 경로의 길이는 고정되어 있는 게 편하다.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre;&quot;&gt;
&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre; font-size: 12px;&quot;&gt;(Data Parsing : 원본 데이터를 원하는 기준으로 나눠서 저장하는 것)&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre;&quot;&gt;
&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre; font-size: 12px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre;&quot;&gt;
&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre; font-size: 12px;&quot;&gt;간단한 예시를 들면&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre;&quot;&gt;
&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre; font-size: 12px;&quot;&gt;/home/male/M0135.png 와 /home/female/F1234.png라는 데이터셋이 있다고 생각하자.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre;&quot;&gt;
&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre; font-size: 12px;&quot;&gt;M은 남자, F는 여자라는 정보를 가지고 있다.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre;&quot;&gt;
&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre; font-size: 12px;&quot;&gt;이제, 성별을 기준으로 나누고 싶어 'M'과 'F'에 접근하려면 path[len(path)-9]으로 접근할 수 있다.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre;&quot;&gt;
&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre; font-size: 12px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre;&quot;&gt;
&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre; font-size: 12px;&quot;&gt;하지만, 0을 채우지 않은 경우는 경로가 /home/male/M135.png 와 /home/female/F1234.png가 될 것이다.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre;&quot;&gt;
&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre; font-size: 12px;&quot;&gt;이 경우, M과 F가 같은 위치에 오지 않으므로, 데이터를 기계적으로 다루기가 어려워진다.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre;&quot;&gt;
&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre; font-size: 12px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre;&quot;&gt;
&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre; font-size: 12px;&quot;&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&lt;b&gt;결론은 주로 파일의 경로명 설정에 사용&lt;/b&gt;&lt;/span&gt;된다는 것이다.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; white-space: pre;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; font-size: 12px;&quot;&gt;물론, 다른 용도로도 많이 사용될 것이다.&lt;/p&gt;&lt;p style=&quot;margin: 0px; color: rgb(1, 1, 1); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; font-size: 12px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;ce-code-text&quot; spellcheck=&quot;false&quot; style=&quot;padding: 10px 0px; background-color: rgb(255, 255, 255); font-family: Consolas, &amp;quot;liberation mono&amp;quot;, Menlo, Courier, monospace; white-space: pre-wrap; width: 821px; height: 337px; border: 0px; outline: 0px; margin-top: 0px; margin-bottom: 0px; tab-size: 4; color: rgb(1, 1, 1);&quot;&gt;&lt;div style=&quot;overflow-wrap: normal; word-break: normal; hyphens: none; white-space: pre; min-width: 1px; height: 14px; padding: 0px 7px;&quot;&gt;&lt;div class=&quot;colorscripter-code&quot; style=&quot;overflow: auto; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace !important; position: relative !important;&quot;&gt;&lt;p style=&quot;font-size: 12px;&quot;&gt;-----------------------------------------------------------------------------------------------&lt;/p&gt;
&lt;p style=&quot;font-size: 12px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;font-size: 12px;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot;font-size: 12px;&quot;&gt;여담으로, &lt;b&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;input을 integer가 아니라 다른 형을 넣으면&lt;/span&gt;&lt;/b&gt; 어떨까 궁금해서 다양하게 실험해봤다.&lt;/p&gt;&lt;div class=&quot;colorscripter-code&quot; style=&quot;overflow: auto; position: relative !important;&quot;&gt;&lt;table class=&quot;colorscripter-code-table&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; style=&quot;margin: 0px; padding: 0px; border: none; background-color: rgb(250, 250, 250); border-radius: 4px;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;padding: 6px; border-right: 2px solid rgb(229, 229, 229);&quot;&gt;&lt;div style=&quot;margin: 0px; padding: 0px; word-break: normal; text-align: right; color: rgb(102, 102, 102); line-height: 16.9px; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace !important;&quot;&gt;&lt;div style=&quot;line-height: 16.9px;&quot;&gt;1&lt;/div&gt;&lt;div style=&quot;line-height: 16.9px;&quot;&gt;2&lt;/div&gt;&lt;div style=&quot;line-height: 16.9px;&quot;&gt;3&lt;/div&gt;&lt;div style=&quot;line-height: 16.9px;&quot;&gt;4&lt;/div&gt;&lt;div style=&quot;line-height: 16.9px;&quot;&gt;5&lt;/div&gt;&lt;div style=&quot;line-height: 16.9px;&quot;&gt;6&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;padding: 6px 0px;&quot;&gt;&lt;div style=&quot;margin: 0px; padding: 0px; color: rgb(1, 1, 1); line-height: 16.9px; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace !important;&quot;&gt;&lt;div style=&quot;padding: 0px 6px; white-space: pre; line-height: 16.9px;&quot;&gt;a&amp;nbsp;=&amp;nbsp;-1&lt;/div&gt;&lt;div style=&quot;padding: 0px 6px; white-space: pre; line-height: 16.9px;&quot;&gt;'{0:05}'.format(a)&amp;nbsp;=&amp;nbsp;'-0001'&lt;/div&gt;&lt;div style=&quot;padding: 0px 6px; white-space: pre; line-height: 16.9px;&quot;&gt;b&amp;nbsp;=&amp;nbsp;'abc'&lt;/div&gt;&lt;div style=&quot;padding: 0px 6px; white-space: pre; line-height: 16.9px;&quot;&gt;'{0:05}'.format(b)&amp;nbsp;--&amp;gt;&amp;nbsp;error&lt;/div&gt;&lt;div style=&quot;padding: 0px 6px; white-space: pre; line-height: 16.9px;&quot;&gt;c&amp;nbsp;=&amp;nbsp;1.53&lt;/div&gt;&lt;div style=&quot;padding: 0px 6px; white-space: pre; line-height: 16.9px;&quot;&gt;'{0:05}'.format(c)&amp;nbsp;=&amp;nbsp;'01.53'&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;vertical-align: bottom; padding: 0px 2px 4px 0px;&quot;&gt;&lt;a href=&quot;http://colorscripter.com/info#e&quot; target=&quot;_blank&quot; style=&quot;color: white;&quot;&gt;&lt;span style=&quot;font-size: 9px; word-break: normal; background-color: rgb(229, 229, 229); border-radius: 10px; padding: 1px;&quot;&gt;cs&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p style=&quot;font-size: 12px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;font-size: 12px;&quot;&gt;결론은, 마이너스 부호나 소수점을 하나의 character로 보고 고정된 길이의 결과를 출력한다.&lt;/p&gt;
&lt;p style=&quot;font-size: 12px;&quot;&gt;혹시 문자열도 되나 싶어서 해봤는데 역시나 안된다.&lt;/p&gt;
&lt;p style=&quot;font-size: 12px;&quot;&gt;코드에 적진 않았지만 배열 입력도 안된다.&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>Programming/Python</category>
      <category>Programming</category>
      <category>Python</category>
      <author>Starwise</author>
      <guid isPermaLink="true">https://starwise.tistory.com/3</guid>
      <comments>https://starwise.tistory.com/3#entry3comment</comments>
      <pubDate>Sat, 1 Dec 2018 01:02:27 +0900</pubDate>
    </item>
  </channel>
</rss>