# Converting bdf file to txt

**URL:** <https://mne.discourse.group/t/converting-bdf-file-to-txt/9154>\
**Category:** Support & Discussions\
**Tags:** eeg\
**Created:** [August 3, 2024, 11:19pm UTC](https://mne.discourse.group/t/converting-bdf-file-to-txt/9154 "2024-08-03T23:19:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Katie888](https://avatars.discourse-cdn.com/v4/letter/k/f19dbf/32.png) [@Katie888](https://mne.discourse.group/u/Katie888)\
**Post date:** [August 3, 2024, 11:19pm UTC](https://mne.discourse.group/t/converting-bdf-file-to-txt/9154/1 "2024-08-03T23:19:28Z")

</div>

**❓ If you have a question or issue with MNE-Python, please include the following info:**  
NME version: 1.7.1  
Operating system: Windows 10 22H2  
IDE: myCharm

Hi, regarding the code below, just want to confirm that  
it is correctly converting the eeg data in the bdf file into a txt file.

Code:  
import numpy as np  
import mne

converted\_path = ‘C:\MyEEG\Newtest17-256.bdf’

mybdf = mne.io.read\_raw\_bdf(converted\_path)  
header = ‘,’.join(mybdf.ch\_names)

converted\_path\_txt = ‘C:\MyEEG\Newtest17-256.txt’

np.savetxt(converted\_path\_txt, # (‘C:\MyEEG\Newtest17-256.txt’,  
mybdf.get\_data().T, delimiter=‘,’, header=header)

print(‘Done!’)
