create/check data dir for arxiv's papers (#531)

pull/548/head
Elmira Ghorbani 12 months ago committed by GitHub
parent 6798e1ca3a
commit 28fef26cc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -150,6 +150,8 @@
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"\n",
"import arxiv\n",
"import ast\n",
"import concurrent\n",
@ -190,6 +192,25 @@
"id": "2de5d32d",
"metadata": {},
"outputs": [],
"source": [
"directory = './data/papers'\n",
"\n",
"# Check if the directory already exists\n",
"if not os.path.exists(directory):\n",
" # If the directory doesn't exist, create it and any necessary intermediate directories\n",
" os.makedirs(directory)\n",
" print(f\"Directory '{directory}' created successfully.\")\n",
"else:\n",
" # If the directory already exists, print a message indicating it\n",
" print(f\"Directory '{directory}' already exists.\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ae5cb7a1",
"metadata": {},
"outputs": [],
"source": [
"# Set a directory to store downloaded papers\n",
"data_dir = os.path.join(os.curdir, \"data\", \"papers\")\n",
@ -197,7 +218,7 @@
"\n",
"# Generate a blank dataframe where we can store downloaded files\n",
"df = pd.DataFrame(list())\n",
"df.to_csv(paper_dir_filepath)\n"
"df.to_csv(paper_dir_filepath)"
]
},
{

Loading…
Cancel
Save