<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>fgshun</author_name>
  <author_url>https://blog.hatena.ne.jp/fgshun/</author_url>
  <blog_title>銀月の符号</blog_title>
  <blog_url>https://fgshun.hatenablog.com/</blog_url>
  <categories>
    <anon>Python</anon>
  </categories>
  <description>今晩の目的、「同名のファイルが存在しても、重ならないファイル名でコピーをする関数」の作成。仮名 copy_safe 。a\spam.txt, b\spam.txt がすでにあるときに、copy_safe(r'a\spam.txt', r'b\spam.txt') すると b\spam(0).txt という名前でコピーするというもの。試作したときは一つの関数だったけれど、「別名を作る」と「コピーする」は別の機能だからと考え直したら分けることに成功。すっきり。ファイル名を変えつつ生成し続けるジェネレータがあればいいことに、気づくのが遅すぎた。頭固いオレ。 itertools.count で連番生成…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Ffgshun.hatenablog.com%2Fentry%2F20090709%2F1247157786&quot; title=&quot;ジェネレータをうまく作れるようになりたい - 銀月の符号&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2009-07-09 01:43:06</published>
  <title>ジェネレータをうまく作れるようになりたい</title>
  <type>rich</type>
  <url>https://fgshun.hatenablog.com/entry/20090709/1247157786</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
